package com.wx.demo;

import com.wx.demo.command.ClassCommand;
import com.wx.demo.command.MemoryCommand;

import java.lang.instrument.Instrumentation;
import java.util.Scanner;

public class AgentMain {

    public static void premain(String agentArgs, Instrumentation inst) {
        System.out.println("hava");
    }

    public static void agentmain(String agentArgs, Instrumentation inst) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("菜单:\n" +
                    "1.查看内存使用情况\n" +
                    "2.打印方法参数和耗时\n" +
                    "3.退出\n");
            String input = scanner.next();
            switch (input) {
                case "1" : {
                    MemoryCommand.printMemory();
                    break;
                }
                case "2" : {
                     ClassCommand.enhanceClass(inst);
                    break;
                }
                case "3" : {
                    return;
                }
                default: return;
            }
        }
    }
}
